//
//  ChangePhoneViewController.m
//  safeLady
//
//  Created by hyu on 2017/1/13.
//  Copyright © 2017年 xmy. All rights reserved.
//

#import "ChangePhoneViewController.h"
#import "ChangePhoneView.h"
@interface ChangePhoneViewController ()<ChangePhoneViewDelegate>;
@property (nonatomic , strong) ChangePhoneView *changePhoneView;
@end

@implementation ChangePhoneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title =@"修改手机号";
    self.phoneNumberLabel.text = [NSString stringWithFormat:@"您当前的手机号为:%@",[self encryptPhoneNumber:self.userClient.userName]];
    // Do any additional setup after loading the view.
}

- (NSString*)encryptPhoneNumber:(NSString*)phoneNumber{
    NSString *rulStr = [phoneNumber stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"****"];
    return rulStr;
}

- (ChangePhoneView *)changePhoneView{
    if (!_changePhoneView) {
        _changePhoneView = [[UINib nibWithNibName:@"ChangePhoneView" bundle:nil] instantiateWithOwner:self options:nil].firstObject;
        _changePhoneView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
        _changePhoneView.delegate = self;
    }
    return _changePhoneView;
}

- (void)removeChangePhoneViewAction{
    [self.changePhoneView removeFromSuperview];
    [self doLogin];
}

- (IBAction)changePhoneAction:(UIButton *)sender {
    [self.view addSubview:self.changePhoneView];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
